<script setup>
import {queryCategoryList} from '@/api/category'
import { onMounted, ref } from 'vue';


//引入树组件
const data = ref([])

const defaultProps = {
    children:'children',
    label:'name'
}
const handleNodeClick = ()=>{}

//加载树
const loadCategory=async ()=>{
    let result = await queryCategoryList();
    data.value= result
}

//预加载
onMounted(()=>{
    loadCategory
})
</script>

<template>
 <el-tree
    style="max-width: 600px"
    :data="data"
    :props="defaultProps"
    @node-click="handleNodeClick"
  />
</template>

<style scoped>
</style>